package com.abc.controller;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/test")
public class Controller {

    @PostMapping("login")
    public JSONObject login(@RequestBody JSONObject jsonObject) {
        JSONObject jsonObjectResult = new JSONObject();
        if (jsonObject.getString("username").equals("罗睿")&&jsonObject.getString("password").equals("123")) {
            jsonObjectResult.put("code", 0000);
            jsonObjectResult.put("msg", "登录成功");
            jsonObjectResult.put("data", "{}");
            return jsonObjectResult;
        }
        jsonObjectResult.put("code", -1);
        jsonObjectResult.put("msg", "登录失败");
        jsonObjectResult.put("data", "null");
        return jsonObjectResult;
    }
}
